package com.woniu.controller;


import com.woniu.been.entity.UserCourse;
import com.woniu.been.entity.UserOrders;
import com.woniu.been.entity.vo.NewsVo;
import com.woniu.mapper.UserCourseMapper;
import com.woniu.service.UserCourseServicce;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.woniu.utils.ResponseResult;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/usercourse")
@CrossOrigin
public class UserCourseController {

    @Autowired
    UserCourseServicce usercourseservicce;

    @PostMapping("isOrder") // usercourse/getIds
    public ResponseResult isOrder(@RequestBody UserCourse userCourse) {
        Map<String,Object> map =  usercourseservicce.isOrder(userCourse);
        return ResponseResult.success(map);
    }

    // 根据订单编号来获取订单id 并且以字符串的形式返回
    @PostMapping("getIds") // usercourse/isOrder
    public ResponseResult getIds(@RequestBody UserOrders userCourse) {
        Map<String,Object> ids =  usercourseservicce.getIds(userCourse);
        return ResponseResult.success(ids);
    }

}
